From: Kenichi Handa Date: Wed, 19 Mar 2003 12:24:43 +0000 (+0000) Subject: (make_specified_string): Fix previous change. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~52935 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=229b28c432a6df8b02b8f6cb492ffd1bedb8db5c;p=emacs.git (make_specified_string): Fix previous change. --- diff --git a/src/alloc.c b/src/alloc.c index d703d3d99b2..2c1d09ac43e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1819,7 +1819,8 @@ make_string_from_bytes (contents, nchars, nbytes) /* Make a string from NCHARS characters occupying NBYTES bytes at CONTENTS. The argument MULTIBYTE controls whether to label the - string as multibyte. */ + string as multibyte. If NCHARS is negative, it counts the number of + characters by itself. */ Lisp_Object make_specified_string (contents, nchars, nbytes, multibyte) @@ -1828,6 +1829,14 @@ make_specified_string (contents, nchars, nbytes, multibyte) int multibyte; { register Lisp_Object val; + + if (nchars < 0) + { + if (multibyte) + nchars = multibyte_chars_in_text (contents, nbytes); + else + nchars = nbytes; + } val = make_uninit_multibyte_string (nchars, nbytes); bcopy (contents, SDATA (val), nbytes); if (!multibyte)